<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'cargo-item-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'marking'); ?>
		<?php echo $form->textField($model,'marking',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'marking'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'item'); ?>
		<?php echo $form->textField($model,'item',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'item'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'country'); ?>
		<?php echo $form->textField($model,'country',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'country'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'qty_id'); ?>
		<?php echo $form->textField($qty,'qty',array('size'=>8,'maxlength'=>11,'placeholder'=>'Pkg')); ?>
		<?php echo $form->dropdownlist($qty,'qty_type',$qty->qtytype); ?>
		
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'cost'); ?>
		<?php echo $form->textField($model,'cost',array('size'=>8,'maxlength'=>10,'placeholder'=>'Cost per pcs')); ?>
		<?php echo $form->dropdownlist($model,'currency',cargo::model()->cur); ?>
		<?php echo $form->error($model,'cost'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
<?php
$cs = Yii::app()->ClientScript;
$ViewURL = CHtml::normalizeUrl(array('cargo/view','id'=>$model->cargo_id));
$script =<<<EOD
$.cargo_item_form = {
	afterSubmit:function(data){
		window.location = "$ViewURL?id="+data.id;
	}
};
$('#cargo-item-form [type=submit]').click(function(){
	var cargoForm = {
		afterSubmit:function(data){
		}
	};
	var form = $.extend($.simplelogform,$.cargo_item_form);
	form.Submit($('#cargo-item-form'));
	return false;
});
EOD;
$cs->registerScript('cargo_item#create#form',$script);
?>
